//
//  UIViewExtension.swift
//  YYProject
//
//  Created by 陆文宇 on 2017/8/11.
//  Copyright © 2017年 陆文宇. All rights reserved.
//

import UIKit

extension UIView {
    
    var yy_width: CGFloat {
        
        get {
            return self.frame.width
        }
        
        set(newValue) {
            var frame = self.frame
            frame.size.width = newValue
            self.frame = frame
        }
    }
    
    var yy_height: CGFloat {
        
        get {
            return self.frame.height
        }
        
        set (newValue) {
            var frame = self.frame
            frame.size.height = newValue
            self.frame = frame
        }
    }
    
    var yy_x: CGFloat {
        
        get {
            return self.frame.origin.x
        }
        
        set(newValue) {
            var frame = self.frame
            frame.origin.x = newValue
            self.frame = frame
        }
    }
    
    var yy_y: CGFloat {
        
        get {
            return self.frame.origin.y
        }
        
        set(newValue) {
            var frame = self.frame
            frame.origin.y = newValue
            self.frame = frame
        }
    }
    
    
    var yy_centerY: CGFloat {
        
        get {
            return self.center.y
        }
        
        set(newValue) {
            var frame = self.frame
            frame.origin.y = newValue
            self.frame = frame
        }
    }
    
    var yy_origin: CGPoint {
        
        get {
            return self.frame.origin
        }
        
        set(newValue) {
            var frame = self.frame
            frame.origin = newValue
            self.frame = frame
        }
    }
    
}
